<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateAppleTreesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('apple_trees', function (Blueprint $table) {
            $table->id();
            $table->string('title')->nullable()->comment('名称');
            $table->integer('apple_tree_period')->nullable()->default(30)->comment('苹果树有效期');
            $table->decimal('consume_apples', 10, 2)->nullable()->default(0);
            $table->decimal('produce_apples', 10, 2)->nullable()->default(0);
            $table->integer('buy_limit')->nullable()->default(10)->comment('限制数量');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('apple_trees');
    }
}
